package com.example.service.impl;

import com.example.mapper.OperateLogMapper;
import com.example.pojo.OperateLog;
import com.example.pojo.PageResult;
import com.example.service.OperateLogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: Sun
 * @Date: 2025/9/28 - 09 - 28 - 13:43
 * @Description: com.example.service.impl
 */
@Service
public class OperateLogServiceImpl implements OperateLogService {
    private final OperateLogMapper operateLogMapper;

    public OperateLogServiceImpl(OperateLogMapper operateLogMapper) {
        this.operateLogMapper = operateLogMapper;
    }

    @Override
    public PageResult<OperateLog> page(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
       List<OperateLog> dataList = operateLogMapper.list();
       Page<OperateLog> page =(Page<OperateLog>) dataList;
       return new PageResult<OperateLog>(page.getTotal(),page.getResult());
    }
}
